﻿
using AutoWelding.Models;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AutoWelding
{
    public static class AppContext
    {
        /// <summary>
        /// 当前登录用户信息
        /// </summary>
        public static UserModel CurrentUser { get; set; }

        /// <summary>
        /// 是否已登录
        /// </summary>
        public static bool IsLoggedIn => CurrentUser != null;

        /// <summary>
        /// 用户权限级别
        /// </summary>
        public static int ThisUserIdentity => CurrentUser?.UserIdentity ?? -1; // 如果没有 默认是-1（游客）
        public static bool IsSuperAdmin => CurrentUser?.UserIdentity == 0; // 超管
        public static bool IsAdmin => CurrentUser?.UserIdentity == 0 || CurrentUser?.UserIdentity == 1; // 超管 或 管理员
    }
}
